1299B - Aerodynamic - CodeForces Solution


geometry *1800

Please click on ads to support us..

C++ Code:

/*
________                               _____.___.           .___            
\______ \   ____   ____ ______  __ __  \__  |   |____     __| _/____ ___  __
 |    |  \_/ __ \_/ __ \\____ \|  |  \  /   |   \__  \   / __ |\__  \\  \/ /
 |    `   \  ___/\  ___/|  |_> >  |  /  \____   |/ __ \_/ /_/ | / __ \\   / 
/_______  /\___  >\___  >   __/|____/   / ______(____  /\____ |(____  /\_/  
        \/     \/     \/|__|            \/           \/      \/     \/      
*/


#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
 
using namespace std;
using namespace chrono;
using namespace __gnu_pbds;

// Macros definition
#define ll long long
#define lld long double
#define ln cout<<"\n"
#define print(a) cout<< a << ' '
#define inf 1e18


typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
// x.find_by_order(1) -> return pointer to element present at index 1
// x.order_of_key(2) -> return index of element 2
// other functions of set works fine

// Predefined values
const ll mod = 1e9+7;

void solve(){
    ll n;
    cin>>n;
    vector<ll>x(n), y(n);
    for(int i=0; i<n; i++){
        cin>>x[i]>>y[i];
    }
    if(n%2){
        print("NO");
        return;
    }

    int x0 = x[0]+x[n/2];
    int y0 = y[0]+y[n/2];

    for(int i=0; i<n/2; i++){
        if(x[i] != x0-x[i+n/2] || y0 != y[i]+y[i+n/2]){
            print("NO");return;
        }
    }

    print("YES");
}

int main(){
	
	// Deepu Yadav
    ios_base :: sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    int t=1;
    // cin>>t;
    while(t--){
        solve();
    }
    return 0;
}


Comments

Submit
0 Comments
More Questions

122A - Lucky Division
1611C - Polycarp Recovers the Permutation
432A - Choosing Teams
758A - Holiday Of Equality
1650C - Weight of the System of Nested Segments
1097A - Gennady and a Card Game
248A - Cupboards
1641A - Great Sequence
1537A - Arithmetic Array
1370A - Maximum GCD
149A - Business trip
34A - Reconnaissance 2
59A - Word
462B - Appleman and Card Game
1560C - Infinity Table
1605C - Dominant Character
1399A - Remove Smallest
208A - Dubstep
1581A - CQXYM Count Permutations
337A - Puzzles
495A - Digital Counter
796A - Buying A House
67A - Partial Teacher
116A - Tram
1472B - Fair Division
1281C - Cut and Paste
141A - Amusing Joke
112A - Petya and Strings
677A - Vanya and Fence
1621A - Stable Arrangement of Rooks